From b4c25d2787cad94ec096b9a9000f4bbb958a4518 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 15 Nov 2005 11:34:29 +0100 Subject: [PATCH] This patch fixed keyboard issue for linux kernel 2.6 in vmx guest. linux 2.6 kernel keyboard use a timer to poll the kbd state,in virtualization environment,the kbd interrupt injection is very likely to happend just after kbd state query in the kbd timer and thus will reverse sequence of scan code. Also fix env->send_event SMP issue. Signed-off-by: Xiaofeng Ling Signed-off-by: Edwin Zhai Signed-off-by: Eddion Dong Signed-off-by: Asit Mallick --- tools/ioemu/target-i386-dm/helper2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/ioemu/target-i386-dm/helper2.c b/tools/ioemu/target-i386-dm/helper2.c index 8c1e085160..b01811d03c 100644 --- a/tools/ioemu/target-i386-dm/helper2.c +++ b/tools/ioemu/target-i386-dm/helper2.c @@ -416,6 +416,7 @@ int main_loop(void) FD_ZERO(&wakeup_rfds); FD_SET(evtchn_fd, &wakeup_rfds); highest_fds = evtchn_fd; + env->send_event = 0 while (1) { if (vm_running) { if (shutdown_requested) { @@ -431,7 +432,6 @@ int main_loop(void) tv.tv_sec = 0; tv.tv_usec = 100000; - env->send_event = 0; retval = select(highest_fds+1, &wakeup_rfds, NULL, NULL, &tv); if (retval == -1) { perror("select"); @@ -447,12 +447,13 @@ int main_loop(void) #define ULONGLONG_MAX ULONG_MAX #endif - main_loop_wait(0); tun_receive_handler(&rfds); if ( FD_ISSET(evtchn_fd, &rfds) ) { cpu_handle_ioreq(env); } + main_loop_wait(0); if (env->send_event) { + env->send_event = 0; struct ioctl_evtchn_notify notify; notify.port = ioreq_local_port; (void)ioctl(evtchn_fd, IOCTL_EVTCHN_NOTIFY, ¬ify); -- 2.30.2